import type { BannerItem, CategoryItem, HotItem, GuessItem } from '@/types/home'
import type { PageResult, PageParams } from '@/types/global'
import { http } from '@/utils/http'

/**
 *首页广告区域
 *广告区域展示位置
 * @param distributionSite   1 为首页（默认值）2 为商品分类页
 * @returns
 */
export const getHomeBannerAPI = (distributionSite = 1) => {
  return http<BannerItem[]>({
    method: 'GET',
    url: '/home/banner',
    data: { distributionSite },
  })
}

/**
 *小程序查询前台分类，只查询一级类目信息（此处pc和app、mini共用了一套前台类目信息）
 * @returns
 */
export const getHomeCategoryMutilAPI = () => {
  return http<CategoryItem[]>({
    method: 'GET',
    url: '/home/category/mutli',
  })
}

/**
 *热门推荐
 * @returns
 */
export const getHomeHotMutilAPI = () => {
  return http<HotItem[]>({
    method: 'GET',
    url: '/home/hot/mutli',
  })
}

/**
 * 猜你喜欢接口
 *
 * data? 表示可选参数
 * @returns
 */
export const getGueeLikeAPI = (data?: PageParams) => {
  return http<PageResult<GuessItem>>({
    method: 'GET',
    url: '/home/goods/guessLike',
    // get请求，直接data就行了
    data,
  })
}
